﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="KnowledgePointMultiSelect.aspx.cs"
    Inherits="YiShi.KnowledgePoint.KnowledgePointMultiSelect" %>

<%@ Register TagPrefix="Custom" TagName="KnowledgePointTree" Src="KnowledgePointTree.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body style="font-size: 9pt;">
    <div style="text-align: center;">
        <Custom:KnowledgePointTree runat="server" ID="Search1" Type="checkbox" Width="450" />
    </div>

    <script language="javascript">
        $(function event() {
            //Init
            var ids = "<%=ids %>";
            var names = "<%=names %>";
            if (ids) {
                var tmp = ids.split(',');
                for (var i = 0; i < tmp.length; i++)
                    $("input:checkbox[value='" + tmp[i] + "']").attr("checked", true);
            }
        });
        function __ReturnChecked() {
            var names = "";
            var ids = "";
            var $eles = $("input:checked");
            if ($eles.length == 0) {
                return { "Text": "", "Value": "" };
            }
            for (var i = 0; i < $eles.length; i++) {
                var $ele = $($eles[i]);
                var $tr = $ele.parents("tr:first");
                if ($tr.attr("Type") == 0) {
                    alert("不允许选择目录结点！");
                    return null;
                }
                names += $tr.find("span[name='NameSpan']").text() + ",";
                ids += $ele.attr("value") + ",";
            }
            names = names.substring(0, names.length - 1);
            ids = ids.substring(0, ids.length - 1);
            return { "Ids": ids, "Names": names };
        }
    </script>

</body>
</html>
